package com.demo2do.fms.queue.dao;

import com.demo2do.core.persistence.annotation.Dao;
import com.demo2do.core.persistence.annotation.Query;
import com.demo2do.core.persistence.annotation.Variable;
import com.demo2do.fms.entity.vehicle.tractor.Tractor;

/**
 *
 * @author Ark
 *
 */
@Dao("hibernate")
public interface TractorDao {

    /**
     * @param brandCNCode
     * @return
     */
    @Query("FROM Tractor WHERE disabled = false AND brandCNCode = :brandCNCode")
    public Tractor getByBrandCNCode(@Variable("brandCNCode") String brandCNCode);
    
    /**
     * @param brandCNCode
     * @param disabled
     * @return
     */
    @Query("FROM Tractor WHERE disabled = :disabled AND brandCNCode = :brandCNCode ORDER BY createTime DESC")
    public Tractor getByBrandCNCode(@Variable("brandCNCode") String brandCNCode, @Variable("disabled") boolean disabled);
    
    /**
     * @param simCard
     * @return
     */
    @Query("FROM Tractor WHERE disabled = false AND simCard = :simCard")
    public Tractor getBySimcard(@Variable("simCard") String simCard);

    /**
     * @param vamId
     * @return
     */
    @Query("FROM Tractor WHERE disabled = false AND vamId = :vamId")
    public Tractor getByVamid(@Variable("vamId") Long vamId);
    
}
